package com.schedule.config;



import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.OncePerRequestFilter;


import java.io.IOException;
/**********
 * //过滤器------拦截项目里操作jwt是否过期
 * //过滤器可以拦截所有资源
 * //过滤器interceptor只会拦截spring环境中的资源
 * 过滤器实现javax.servlet.Filter接口,使用依赖于Tomcat（响应数据压缩）
 * 拦截器Interceptor实现了servlet接口由Spring容器进行管理（登录权限日志等）
 *Request->tomcat->Filter->servlet->interceptor->controller-\
 * Response<-----------------------------------------------
 * **/

/***过滤器**/
//@Configuration
public class FilterConfig extends OncePerRequestFilter {

//    @Autowired
//    private JwtProperties jwtProperties;

    private static final String PATH="/admin/login";

    //拦截资源

    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
//
//        jwtProperties.getTokenName();

        if (request.getRequestURI().equals(PATH)){
            filterChain.doFilter(request,response);//放行
        }


    }


}
